package com.ruoyi.web.controller.kiku;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.kiku.domain.KikuMusicInfo;
import com.ruoyi.kiku.service.IKikuMusicInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 小鞠音乐信息Controller
 *
 * @author TT
 * @date 2025-03-12
 */
@RestController
@RequestMapping("/kiku/musicInfo")
public class KikuMusicInfoController extends BaseController
{
    @Autowired
    private IKikuMusicInfoService kikuMusicInfoService;

    /**
     * 查询小鞠音乐信息列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:musicInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(KikuMusicInfo kikuMusicInfo)
    {
        startPage();
        List<KikuMusicInfo> list = kikuMusicInfoService.selectKikuMusicInfoList(kikuMusicInfo);
        return getDataTable(list);
    }

    /**
     * 导出小鞠音乐信息列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:musicInfo:export')")
    @Log(title = "小鞠音乐信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KikuMusicInfo kikuMusicInfo)
    {
        List<KikuMusicInfo> list = kikuMusicInfoService.selectKikuMusicInfoList(kikuMusicInfo);
        ExcelUtil<KikuMusicInfo> util = new ExcelUtil<KikuMusicInfo>(KikuMusicInfo.class);
        util.exportExcel(response, list, "小鞠音乐信息数据");
    }

    /**
     * 获取小鞠音乐信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:musicInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(kikuMusicInfoService.selectKikuMusicInfoById(id));
    }

    /**
     * 新增小鞠音乐信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:musicInfo:add')")
    @Log(title = "小鞠音乐信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KikuMusicInfo kikuMusicInfo)
    {
        return toAjax(kikuMusicInfoService.insertKikuMusicInfo(kikuMusicInfo));
    }

    /**
     * 修改小鞠音乐信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:musicInfo:edit')")
    @Log(title = "小鞠音乐信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KikuMusicInfo kikuMusicInfo)
    {
        return toAjax(kikuMusicInfoService.updateKikuMusicInfo(kikuMusicInfo));
    }

    /**
     * 删除小鞠音乐信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:musicInfo:remove')")
    @Log(title = "小鞠音乐信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(kikuMusicInfoService.deleteKikuMusicInfoByIds(ids));
    }
}
